package cn.candy.basic.util;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 封装增删改的结果
 */
@Data
@NoArgsConstructor
public class AjaxResult {
	
	private Boolean success = true; 	//是否成功
	private String msg = "操作成功";      //失败消息
	private Object resultObj;     		//数据

	public AjaxResult(Boolean success, String msg) {
		this.success = success;
		this.msg = msg;
	}

	//成功不携带数据返回
	public static AjaxResult me(){
		AjaxResult ajaxResult = new AjaxResult();
		return ajaxResult;
	}

	//链式编程语法：
	public AjaxResult setSuccess(Boolean success) {
		this.success = success;
		return this;
	}
	//链式编程语法：
	public AjaxResult setMsg(String msg) {
		this.msg = msg;
		return this;
	}
	//链式编程语法：
	public AjaxResult setResultObj(Object resultObj) {
		this.resultObj = resultObj;
		return this;
	}

}
